import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println(isPrim(57));
        int T = scanner.nextInt();
        for(int t = 0 ; t < T ;t++){
            int n = scanner.nextInt();

            for (int current = n /2; current >= 2 ; current--) {
                int tmp = gcd(n,current);
                if (isPrim(tmp) ){
                    System.out.println(current);
                    break;
                }
            }
        }
        scanner.close();
    }
    private static  int gcd(int a, int b){
        while( b != 0){
            int tmp = b;
            b = a % b;
            a= tmp;
        }
        return a;
    }

    private static boolean isPrim(int a){
        if( a < 2){
            return false;
        }
        for (int i = 2; i  <= Math.sqrt(a); i++) {
            if(a % i ==0){
                return false;
            }
        }
        return true;
    }
}
